package com.example.product.service;

import com.example.product.entity.Money;
import com.example.product.repository.MoneyRepository;
import io.seata.spring.annotation.GlobalTransactional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class MoneyService {
    @Autowired
    private MoneyRepository repository;

    @GlobalTransactional(rollbackFor = Exception.class)
    public void add(Integer stuId,Integer mm){
        Money money=new Money();
        money.setStuId(stuId);
        money.setMm(mm);
        repository.save(money);
        try {
            int i=Integer.valueOf("aaa");
        }catch (Exception e){
            e.printStackTrace();
        }
    }
}
